package com.hhkj.admin.student.service.biz.impl;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hhkj.admin.student.domain.Student;
import com.hhkj.admin.student.model.dopo.StudentDo;
import com.hhkj.admin.student.model.dopo.StudentLoginLogDo;
import com.hhkj.admin.student.model.dopo.StudentLoginLogPo;
import com.hhkj.admin.student.model.dopo.StudentPo;
import com.hhkj.admin.student.model.req.StudentLoginLogReq;
import com.hhkj.admin.student.model.req.StudentReq;
import com.hhkj.admin.student.model.res.StudentLoginLogRes;
import com.hhkj.admin.student.model.res.StudentRes;
import com.hhkj.admin.student.service.base.StudentLoginLogService;
import com.hhkj.admin.student.service.base.StudentService;
import com.hhkj.admin.student.service.biz.StudentLoginLogBizService;
import com.hhkj.admin.student.service.extend.StudentExtendService;
import com.hhkj.admin.student.service.extend.StudentLoginLogExtendService;
import com.ruoyi.common.base.biz.service.biz.BaseBizServiceImpl;
import com.ruoyi.system.domain.StudentLoginLog;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 学员登录记录BizService接口
 *
 * @author ruoyi
 * @since 2023-06-08
 */
@Service
public class StudentLoginLogBizServiceImpl
        extends BaseBizServiceImpl<StudentLoginLog, StudentLoginLogReq, StudentLoginLogRes, StudentLoginLogDo, StudentLoginLogPo, StudentLoginLogService, StudentLoginLogExtendService>
        implements StudentLoginLogBizService {
    @Autowired
    private StudentLoginLogService studentLoginLogService;

    /**
     * 查询学员登录日志列表
     *
     * @param studentLoginLogReq 学员登录日志
     * @return 学员登录日志
     */
    @Override
    public List<StudentLoginLog> selectStudentLoginLogList(StudentLoginLogReq studentLoginLogReq) {
        return studentLoginLogService.list(Wrappers.<StudentLoginLog>lambdaQuery()
                .like(studentLoginLogReq.getStudentName() != null, StudentLoginLog::getStudentName, studentLoginLogReq.getStudentName())
                .eq(studentLoginLogReq.getStudentId() != null, StudentLoginLog::getStudentId, studentLoginLogReq.getStudentId())
                .eq(studentLoginLogReq.getCourseId() != null, StudentLoginLog::getCourseId, studentLoginLogReq.getCourseId())
                .le(studentLoginLogReq.getEndDate() != null, StudentLoginLog::getLoginTime, studentLoginLogReq.getEndDate())
                .ge(studentLoginLogReq.getStartDate() != null, StudentLoginLog::getLoginTime, studentLoginLogReq.getStartDate()));
    }
}
